package Utils;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public  class getTime {
//    返回当前时间(格式化)
    public  static String getDateTime(){
        Calendar myData = Calendar.getInstance();
        myData.setTime(new Date());
        Date date = myData.getTime();
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String strRtn = format.format(date);
        return  strRtn;
    }

    public static  String getDate(){
        Calendar myData = Calendar.getInstance();
        myData.setTime(new Date());
        Date date = myData.getTime();
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
        String strRtn = format.format(date);
        return strRtn;
    }
}
